import 'package:flutter/material.dart';
import '../model/category.dart';

class ChildCategory with ChangeNotifier{
  int value =0;
  List<BxMallSubDto> childcategoryList = new List(); //子分类
  int childIndex = 0; //子类高亮索引
  String categoryId = '4';//大类的Id
  String subId = ''; //子类Id
  int page = 1 ;//列表页数
  String noMoreText = '加载成功';//显示没有数据的文字

 //大类切换逻辑
  getChildCategory(List<BxMallSubDto> list,String id){
    childIndex = 0;//大类切换时 让子类索引归0
    subId='';
    categoryId = id; //设置大类的Id
    page = 1; //让页数变为1
    noMoreText='加载成功';
    BxMallSubDto all = new BxMallSubDto(mallSubId:'',mallCategoryId:'',mallSubName:'全部',comments:'');
    childcategoryList=[all];
    childcategoryList.addAll(list); //
    notifyListeners();
  }
  //改变子类索引
  changeChildIndex(int index,String subCategoryIdId){
    childIndex = index;
    subId = subCategoryIdId;
    page = 1; //让页数变为1
    noMoreText='加载成功';
    notifyListeners();
  }
  //增加page的方法
  addpage(){
    page++;
  }
  //改变Nomore
  changeNoMore(String text){
    noMoreText=text;
    notifyListeners();
  }

}
